package ge.telasi.tasks.ui.comp;

import ge.telasi.tasks.ui.UIUtils;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

/**
 * @author dimitri
 */
public class PaintUtils {

    static public void paintSuggestion(Graphics2D g2d, String suggestion, int width, int height) {
        Font newFont = UIUtils.makeItalic(g2d.getFont());
        newFont = UIUtils.changeSize(newFont, -2);
        int fontHeight = g2d.getFontMetrics().getHeight();
        int y = height - fontHeight / 2;
        g2d.setFont(newFont);
        g2d.setColor(new Color(200, 200, 200));
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.drawString(suggestion, 5, y);
    }

    static public void paintError(Graphics2D g2d, int width, int height) {
        int x, y;
        int right = 5;
        // circle
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setColor(Color.RED);
        int diameter = 8;
        x = width - right - diameter;
        y = (height - diameter) / 2;
        g2d.fillOval(x, y, diameter, diameter);
        // rectangle
        g2d.setColor(Color.WHITE);
        int rectH = 2;
        int rectW = 6;
        x = width - right - diameter + (diameter - rectW) / 2;
        y = (height - rectH) / 2;
        g2d.fillRect(x, y, rectW, rectH);
    }

}
